import {ref} from 'vue'

// 全部商品列表接口
export interface IgoodList {
    page?:number
    title?:string
    category_id?:number
    sales?:number
    recommend?:number
    price?:number
    comments_count?:number
}

// 商品详情数据接口
interface Igoods {
    title:string
    cover_url:string
    description?:string
    price:number
    stock:number
    details?:string,
    is_collect?:number

    num?:number
}
// 相似商品
interface ILikeGoods {
    cover_url:string,
    collects_count:number,
    price:number,
    id:number,
    title:string
}
interface IarrayLikeGoods extends Array<ILikeGoods> {}
// 商品详情页数据实现类
export class InitGoodsData {
    goods:Igoods = {
        title:'',
        cover_url:'',
        description:'',
        price:0,
        stock:0,
        details:'',
        is_collect:0
    }
    like_goods:IarrayLikeGoods = [
        {
            cover_url:'',
            collects_count:0,
            price:0,
            id:0,
            title:''
        }
    ]
    active = ref<number>(0)
}

// 购物车列表数据接口
interface IcartData {
    goods:Igoods
    num:number,
    is_checked:number|boolean,
    id:number
}
// 添加购物车数据接口
export interface IaddCartData {
    goods_id:number,
    num:number
}
// 数组对象类型的接口 [{},{},{}]
export interface IarrayCartData extends Array<IcartData> {}
